#include "Shadow.h"
#include "../SGD Wrappers/SGD_Event.h"
#include "GameplayState.h"
#include "../SGD Wrappers/SGD_GraphicsManager.h"

Shadow::Shadow()
{
	shadows = &GameplayState::GetInstance()->shadows;
}
Shadow::~Shadow()
{
	shadows = nullptr;

}
void Shadow::Render(void)
{
	SGD::Point renderPos = SGD::Point(m_ptPosition.x

		- GameplayState::GetInstance()->GetCamera()->GetPosition().x,
		m_ptPosition.y

		- GameplayState::GetInstance()->GetCamera()->GetPosition().y);

	SGD::GraphicsManager::GetInstance()->DrawTextureSection(*shadows, renderPos, renderRect, 0.0f, {}, { 200, 0, 0, 0 });

	SGD::GraphicsManager::GetInstance()->DrawRectangle(GetRect(), SGD::Color(0, 0, 0, 0), SGD::Color(255, 0, 0, 0));


}

/*virtual*/ void Shadow::HandleCollision(const IBase* pOther) /*override*/
{
	if (pOther->GetType() == OBJ_PLAYER)
	{
		SGD::Event* msg = new SGD::Event("SHADOW_HIDE");
		msg->QueueEvent();
		msg = nullptr;

	}
	
}
/*virtual*/ SGD::Rectangle Shadow::GetRect(void)	const
{
	SGD::Point renderPos = SGD::Point(m_ptPosition.x

		- GameplayState::GetInstance()->GetCamera()->GetPosition().x,
		m_ptPosition.y

		- GameplayState::GetInstance()->GetCamera()->GetPosition().y);
	return SGD::Rectangle(renderPos, m_szSize);
}